{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0 1 2 3 4 5 6 7 8 9]\n"
     ]
    },
    {
     "data": {
      "text/plain": "4.5"
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#平均数\n",
    "import numpy as np\n",
    "\n",
    "x = np.arange(10)\n",
    "print(x)\n",
    "np.mean(x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[ 0.  1.  2.  3.  4.  5.  6.  7.  8.  9. nan]\n"
     ]
    },
    {
     "data": {
      "text/plain": "nan"
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "xWithNan = np.hstack((x,np.nan))#nan表示缺失值\n",
    "print(xWithNan)\n",
    "np.mean(xWithNan)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "outputs": [
    {
     "data": {
      "text/plain": "4.5"
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.nanmean(xWithNan)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "outputs": [
    {
     "data": {
      "text/plain": "4.5"
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#中位数\n",
    "np.median(x)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "outputs": [
    {
     "data": {
      "text/plain": "ModeResult(mode=array([3]), count=array([3]))"
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#众数\n",
    "from scipy import stats  #提供众数的值和频数\n",
    "data = [1,2,3,3,3,4,5,6,7,6]\n",
    "stats.mode(data)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "outputs": [
    {
     "data": {
      "text/plain": "37.992689344834304"
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#几何均值\n",
    "x = np.arange(1,101)\n",
    "stats.gmean(x)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "outputs": [
    {
     "data": {
      "text/plain": "array([-3.37197479, -0.62802521])"
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#正态分布\n",
    "mu = -2\n",
    "sigma = 0.7\n",
    "Mydistribution = stats.norm(mu,sigma)\n",
    "signilever = 0.05\n",
    "Mydistribution.ppf([signilever/2,1-signilever/2])\n"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.09658131855962336\n"
     ]
    },
    {
     "data": {
      "text/plain": "<Figure size 432x288 with 1 Axes>",
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD4CAYAAAAXUaZHAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAPsUlEQVR4nO3df6zddX3H8edrFF2iRMpaay3Vq0u3BJcMyQ1j0ywsLAhlsZgsBLJIpyTVDBJJXJaqySQzJHWbmplsLHUQ68JUnDKagdPamRj/AL2QUlqQUbQEmtJWMYA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59txAT/wqWpsN9lvfSO5obpICvJ7m/+1qEURr01Qyzw/OlPt2T/FngN0Zc18t000FvBe4bsPr3kzyY5KtJ3jLeyuZ9vBayj8fhauDzc6yb5P4DWFdVR7vlp4F1A/qshP24Ul63s93QTRvdNseU1sT33Wn/S0xJvgG8bsCqj1TVXV2fjwAvALfPcTdvr6ojSV4L7Enyve4v9q+sJK8GvgzcWFXPzVr9AL2php90843/AWwaY3kr/vHqPrz3TuBDA1ZPev/9kqqqJCvunOgV/Lq9BfgYvT8uHwM+Qe+P0Ipy2h+5V9UfV9XvDLicDPY/B/4E+LPqJsMG3MeR7vo4cCe9/1KNykK+muGlPklWAa8BfjTCmn5JkjPpBfvtVfWV2eur6rmq+km3fA9wZpI146pvAY/XSvj6i8uBB6rq2OwVk95/nWMnp6q66+MD+kxsP67A123/uMeq6sWq+jnwmTnGnfhz8LQP91NJ7wdD/gp4Z1X9dI4+r0py1sllem/mHBjUd5ks5KsZdgMnz0z4U+C/53qCL7dubv9W4JGq+uQcfV538j2AJBfSex6N5Y/PAh+v3cC13VkzFwHP9k1BjMs1zDElM8n916f/ObYVuGtAn68BlyZZ3U09XNq1jdQKfd32j93//s275hh38l/BMs53b8d9AQ7Rm/fa111OnoHyeuCebvnN9N7JfhA4SG86Z9R1baZ3FsrjJ8cD/obekxng14EvdfV/B3jzGPfZ2+n9d3N/337bDLwfeH/X54ZuXz1I7w2vPxhjfQMfr1n1hd6PxTwOPARMj/l59yp6Yf2avraJ7T96f2SOAv9Hb+73Onrv4ewFHgO+AZzT9Z2m98tpJ7d9b/c8PAS8Z0y1rZjX7Rz1/Wv3vNpPL7DXz66vu/2y1/k4L379gCQ1qOlpGUn6VWW4S1KDDHdJapDhLkkNMtwlqUGGuyQ1yHCXpAb9P/C0MOjqfnvdAAAAAElFTkSuQmCC\n"
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "from scipy import stats\n",
    "import pandas as pd\n",
    "import seaborn as sns\n",
    "\n",
    "nd = stats.norm(5,3)\n",
    "data1 = nd.rvs(1000)\n",
    "se = np.std(data1,ddof=1)/np.sqrt(1000)\n",
    "print('{0}'.format(se))\n",
    "plt.hist(data1)\n",
    "plt.show()\n",
    "\n"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  }
 ],
 "metadata": {
  "kernelspec": {
   "name": "pycharm-999df490",
   "language": "python",
   "display_name": "PyCharm (Statistics)"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}